<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@page import="util.*"%>
<%@page import="dal.*,bll.*"%>
<%@ page import="model.*,java.util.*"%>
<%
	boolean embedded = MiscUtil.getBoolUrlParam(request, "embedded");
	int id = MiscUtil.getIntUrlParam(request, "id");
	AgendaModel agenda = CommonBll.loadFullAgenda(id);
	
	String agendaName = agenda.getName();
	String agendaListUrl = "agendaList.jsp?idProject=" + agenda.getIdProject();

	String projectName = CacheUtil.getProjectName(agenda.getIdProject());
	String projectUrl = "project.jsp?id=" + agenda.getIdProject();

	List<AgendaItemModel> list = agenda.getItems();
	int size = list.size();
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Agenda Item List</title>
<%if(!embedded){ %>
		<link rel="stylesheet" href="css/jquery-ui-1.8.14.custom.css" type="text/css" />
		<link rel="stylesheet" href="css/themes/ui-lightness/jquery.ui.all.css" />
		<link rel="stylesheet" href="css/jquery-dialog.css" />
		
		<script language="javascript" type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery-ui-1.8.14.custom.min.js"></script>
		<script language="javascript" type="text/javascript" src="js/common.js"></script>
	<%} %> 
	<link rel="stylesheet" href="css/listForm.css" />
	<link rel="stylesheet" href="css/common.css" />
	<script language="javascript" type="text/javascript">
		$(document).ready(pageLoaded);
		function pageLoaded()
		{	
			initDeleteConfirmation();
		} 
	</script>
</head>
<body>
	<%
		if (!embedded) {
	%>
	<div class="divContainer">
		<%@ include file="menu.jsp"%>
		<div class="divNavigation">
				<span>
				<br />
				<br />
				<b>Project: <a id="link_project" name="link_project" href="<%=projectUrl %>"><%=projectName %></a></b>&gt;
				<b>Agenda: <%=agendaName %></b>
				<br/><br />
				<a style="font-weight: bold;" href="agendaItemNew.jsp?idAgenda=<%=id%>">Add New Agenda Item</a><br />
				<a style="font-weight: bold;" href="<%=agendaListUrl %>">Go Up to Agenda List</a><br />
				<br />
			</span>
		</div>
	<%
		}
	%>

	<div class="divListHeaderBar" style="vertical-align:  middle;"><span style="padding-top: 0px;">NUMBER OF AGENDAS: </span><%=size%></div>
	<table class="tblList">
		<tr class="tblListHeader">
			<!-- <th class="tdListHeader">No</th> -->
			<!-- <th class="thListHeader">Id</th>
			<th class="thListHeader">Id Agenda</th>
			<th class="thListHeader">Id Parent</th> -->
			<th class="thListHeader functionColumnNormal"></th>
			<th class="thListHeader">Start Time</th>
			<th class="thListHeader">Duration<br />(minutes)</th>
			<th class="thListHeader">Name</th>
			<th class="thListHeader">Description</th>
			<!-- <th class="thListHeader">Is Group</th>
			<th class="thListHeader">Id Prev Item</th> -->
			<th class="thListHeader">PIC</th>
			<!-- <th class="thListHeader">Id Company</th> -->
			<th class="thListHeader">Sound</th>
			<th class="thListHeader">Light</th>
			<th class="thListHeader">Left Screen</th>
			<th class="thListHeader">Right Screen</th>
			<!-- <th class="thListHeader">Center Screen</th> -->
			<!-- <th class="thListHeader">Code</th>
			<th class="thListHeader">Id Type</th>
			<th class="thListHeader">Status</th>
			<th class="thListHeader">Notification</th>
			<th class="thListHeader">Created</th>
			<th class="thListHeader">Creator</th>
			<th class="thListHeader">Updated</th>
			<th class="thListHeader">Updator</th>
			<th class="thListHeader">Deleted</th>
			<th class="thListHeader">Deletion Time</th> -->
			<th class="thListHeader">Remark</th>
		</tr>

		<%
			for (AgendaItemModel obj : agenda.getItems()) {
		%>

		<tr class="trListItem">
			<%-- <td class="tdListInt"><%=i + 1%></td> --%>
			<td class="tdListHref Edit">
				<a href="agendaItem?mode=edit&id=<%=obj.getId()%>">Edit</a>
				<br/>
				<a class="hrefDelete" href="agendaItem?mode=delete&id=<%=obj.getId()%>" onclick="confirmToDelete();">Delete</a>
			</td>	
			<%-- <td class="tdList"><%=obj.getId()%></td>
			<td class="tdListInt"><%=obj.getIdAgenda()%></td>
			<td class="tdListInt"><%=obj.getIdParent()%></td> --%>
			<td class="tdListDateTime" style="text-align: center;"><%=StringUtil.toDateTimeString(obj.getStartTime())%></td>
			<td class="tdListInt" style="text-align: center;"><%=obj.getDurationToString()%></td>
			<td class="tdListText tdItemName" style="font-weight: bold; width: 200px;"><%=obj.getNameToString()%></td>
			<td class="tdListTextarea" style="width: 350px;"><%=obj.getDescriptionToString()%></td>
			<%--
			<td class="tdListBool"><%=obj.getIsGroup()%></td>
			<td class="tdListInt"><%=obj.getIdPrevItem()%></td> --%>
			<td class="tdListInt"><%=StringUtil.displayStringArray(new String[] {
						CacheUtil.getEmployeeName(obj.getIdEmployee()),
						CacheUtil.getCompanyName(obj.getIdCompany()) }, "/")%></td>
			<%-- <td class="tdListInt"><%=obj.getIdCompany()%></td> --%>
			<td class="tdListTextarea"><%=obj.getSoundToString()%></td>
			<td class="tdListTextarea"><%=obj.getLightToString()%></td>
			<td class="tdListTextarea"><%=obj.getLeftScreenToString()%></td>
			<td class="tdListTextarea"><%=obj.getRightScreenToString()%></td>
			<%-- <td class="tdListTextarea"><%=obj.getCenterScreen()%></td>
			<td class="tdListText"><%=obj.getCode()%></td>
			<td class="tdListInt"><%=obj.getIdType()%></td>
			<td class="tdListInt"><%=obj.getStatus()%></td>
			<td class="tdListInt"><%=obj.getNotification()%></td>
			<td class="tdListDateTime"><%=obj.getCreated()%></td>
			<td class="tdListInt"><%=obj.getCreator()%></td>
			<td class="tdListDateTime"><%=obj.getUpdated()%></td>
			<td class="tdListInt"><%=obj.getUpdator()%></td>
			<td class="tdListBool"><%=obj.getDeleted()%></td>
			<td class="tdListDateTime"><%=obj.getDeletionTime()%></td> --%>
			<td class="tdListTextarea" style="width: 200px;"><%=obj.getRemarkToString()%></td>
		</tr>
		<%
			}
		%>
	</table>
<%if(!embedded){ %> </div> <%} %>
</body>
</html>